<?php

App::uses('AppModel', 'Model');

/**
 * OrderItem Model
 *
 * @property Order $Order
 * @property Product $Product
 */
class OrderItem extends AppModel {

    public $table = 'order_itens';
    public $actsAs = array('CakePtbr.AjusteData', 'CakePtbr.AjusteFloat', 'Search.Searchable');
    public $filterArgs = array(
        'id' => array('type' => 'value'),
        'order_id' => array('type' => 'value'),
        'product_id' => array('type' => 'value'),
        'name' => array('type' => 'like'),
        'quantity' => array('type' => 'like'),
        'weight' => array('type' => 'like'),
        'price' => array('type' => 'like'),
        'subtotal' => array('type' => 'like'),
        'productmod_name' => array('type' => 'like'),
        'created' => array('type' => 'like'),
        'modified' => array('type' => 'like'),
    );


    //The Associations below have been created with all possible keys, those that are not needed can be removed

    /**
     * belongsTo associations
     *
     * @var array
     */
    public $belongsTo = array(
        'Order' => array(
            'className' => 'Order',
            'foreignKey' => 'order_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Product' => array(
            'className' => 'Product',
            'foreignKey' => 'product_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
    );

}
